<?php

function chap0_sf_login()
{
	if ( !User::is_login() )
	{
		$username = G::val($_POST, 'username');
		$password = G::val($_POST, 'password');

		$user = User::login($username, $password);
		if ( !$user )
		{
			Dao::flash('error', "用户名或者密码不正确");
			redirect(url(ROUTE_HTML_APP, url_sfparams('chap0','login',array(
					'username' => $username,
					'password' => $password,
				))), 0);
		}

		Dao::flash('success', "登录成功");
	}	
	redirect(url(ROUTE_HTML_APP, url_params('chap0','index')), 0);
}

?>